This forum is closed to new posts and
responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:
RE: NotesDatabase.GetDocumentByUNID does NOT return Nothing? ~Elizabeth Lopfoosonikle 1.Dec.03 06:28 AM a Web browser Applications Development 6.0.2 CF2Windows 2000
From my quick tests, its seems that as you have said, the help is wrong and the error is thrown.
Just handle the error and you can continue on.
Here is some sample code i whipped up:
_______________________________________________
Sub Initialize
'--- Turn error handling on.
On Error Goto ErrorHandler
Dim ss As New NotesSession
Dim db As NotesDatabase
Dim dc As NotesDocumentCollection
Dim doc As NotesDocument
Dim doc2 As NotesDocument
Dim unid As String
Set db = ss.CurrentDatabase
Set dc = db.AllDocuments
Set doc = dc.GetFirstDocument
unid = doc.UniversalID
'--- Remove the doc
doc.Remove True
'--- Try and get it by its unid we stored
Set doc2 = db.GetDocumentByUNID(unid)
'--- Check to see if the object is nothing
If doc2 Is Nothing Then
Print "ERROR"
Else
Print "No Error"
End If
Exit Sub
ErrorHandler:
Select Case Err
Case 4091
'--- This is the error code for the error thrown by there not being a match on the UNID
'--- In this case we can resum next cos doc2 will now be Nothing and will get caught in the ext part of the code.
Resume Next
Case Else
Msgbox "Error: " & Err & " occured. The message for this error is: " + Error$ + ". (LINE: " & Erl & ")"
End Select
End
End Sub
______________________________________________